﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TE3
{
	public class EntityManager
	{
		private TE3Game _currentGame;
		public Dictionary<String, Entity> Entities;
		public EntityManager(TE3Game game)
		{
			Entities = new Dictionary<string, Entity>();
			_currentGame = game;
		}
		public void AddEntity(Entity entity, string name,bool isDrawable = true, bool isThinkable = false)
		{
			Entities.Add(name,entity);
			if(isDrawable)
			{
				_currentGame.DrawManager.Drawables.Add(name + "_drawable",(DrawableEntity)entity);
			}
			if(isThinkable)
			{
				_currentGame.ThinkableList.Add((IThinkable)entity);
			}
		}
		public void DestroyEntity(string name, bool isDrawable = true)
		{
			if(isDrawable)
			{
				_currentGame.DrawManager.Drawables.Remove(name + "_drawable");
			}
			Entities.Remove(name);
		}
	}
}
